<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>

<HTML>
<HEAD>
<base href="${pageContext.request.contextPath}/"/>

<TITLE>搜房网租房</TITLE>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

<link href="style/mycss.css" rel="stylesheet" type="text/css" />
<link href="style/texts.css" rel="stylesheet" type="text/css" />
<link href="style/btn.css" rel="stylesheet" type="text/css" />
	<script src="js/jquery-2.2.4.js" type="text/javascript"></script>

<script type="text/javascript">
$(function(){
    $.ajax({
        url: "house/load_district",  // 请求URL
        type: "GET",
        data: {}, //请求的参数
        dataType: "json", // 响应的内容类型：text, html, json, script, xml, jsonp
        success: function (resp) {
            $.each(resp, function (i, item) { // foreach item, item={id:101,name:"海淀"}
                var opt = new Option(item.name,item.id);
                $('#qxid').append(opt);
            });
        }
    });

    //选择街道是时加载
    $('#qxid').change(function () {
        console.log("区县编号：" + $('#qxid').val());
        $('#streetId').empty();
        $('#streetId').append('<option value="">不限--</option>');

        $.get("house/load_street_by_districtId",{"id": $('#qxid').val()}, function (resp) {
            console.dirxml(resp);
            $.each(resp, function (i, item) { // foreach item, item={id:101,name:"海淀"}
                var opt = new Option(item.name,item.id);
                $('#streetId').append(opt);
            });
        },'json');
    });


});

function validateTitle(){
	var pass = false;
	if(document.mf.title.value ==""){
		alert("标题不能为空");
		pass = false;
	}else {
		pass = true;
	}
	if(isNaN(document.mf.rent.value)){
		alert("租金不是数字");
		pass = false;
	}
	return pass;
}
</script>
</HEAD>
<BODY BGCOLOR=#FFFFFF LEFTMARGIN=0 TOPMARGIN=0 MARGINWIDTH=0 MARGINHEIGHT=0>

<table width="780" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td colspan="5"><img src="images/top.jpg" width="780" height="213"></td>
  </tr>
  <tr>
    <td colspan="5"><img src="images/middle1.jpg" width="780" height="47"></td>
  </tr>
  <tr>
    <td width="38" background="images/middle2.jpg">&nbsp;</td>
    <td width="172" valign="top">
	<table align="center">
	<tr>
		<td width=''><font color='red'>
			当前用户：${sessionScope.logUser.userName}
		</font>
		</td>
	</tr>
	<tr>
		<td width='150'><a href="house/find_for_me">管理我的租房信息</a></td>
	</tr>
	<tr>
		<td width='100'><a href="views/post.jsp">发布租房信息</a></td>
	</tr>
	<tr>
		<td width='100'><a href="house/search">返回首页</a></td>
	</tr>
	<tr>
		<td width='100'><a href="user/logOff">[注销]</a></td>
	</tr>
	</table>
</td>
    <td width="35" background="images/layout_24.gif">&nbsp;</td>
    <td width="495">

	<form action="house/insert" method="post" name="mf" onsubmit="return validateTitle()">

		<input type="hidden"  name="userId" value="${sessionScope.logUser.userId}">

		<table>
			<tr>
				<td colspan="2">发布租房信息：</td>
			</tr>
			<tr>
				<td colspan="2"><hr/></td>
			</tr>
			<tr>
			  	<td style="width: 70px;"><strong>标题：</strong></td>
				<td><input type="text" name="title" id="title"></td>
			</tr>
			<tr>
			  	<td><strong>区县：</strong></td>
				<td>
					<select id="qxid" style="width:110px">
						<option value=''>不限--</option>
					</select>
				</td>
			</tr>
			<tr>
			  <td><strong>街道：</strong></td>
				<td>
					<select id="streetId" name="streetId" style="width:110px">
						<option value="">不限--</option>
					</select>
				</td>
			</tr>
			<tr>
			  <td><strong>租金：</strong></td>
				<td><input type="text" name="price" id="price">元/月</td>
			</tr>
			<tr>
			  	<td><strong>房间数：</strong></td>
				<td>
					<select name="room" >
						<option value="1">一室</option>
						<option value="2">二室</option>
						<option value="3">三室</option>
						<option value="4">四室</option>
					</select>
					<select name="hall" >
						<option value="1">一厅</option>
						<option value="2">二厅</option>
						<option value="3">三厅</option>
					</select>
				</td>
			</tr>
			<tr>
			  <td><strong>房屋类型：</strong></td>
				<td>
					<select name="typeId" >
						<option value="">不限</option>
						<option value="1">地下室</option>
						<option value="2">平房</option>
						<option value="3">普通住宅</option>
						<option value="4">公寓</option>
						<option value="5">别墅</option>
					</select>
				</td>
			</tr>
			<tr>
			  <td><strong>联系电话：</strong></td>
				<td><input type="text" name="telephone" id="telephone"> </td>
			</tr>
			<tr>
			  <td><strong>联系人：</strong></td>
				<td><input type="text" name="contact" id="contact"></td>
			</tr>
			
			<tr>
			  <td><strong>房屋信息：</strong></td>
				<td>
					<textarea name="description" id="description" cols="30" rows="5"></textarea>
				</td>
			</tr>
			<tr>
				<td colspan="2">
					<div align="center"><input type="submit" value="提交" class="btn"></div>
				</td>
			</tr>
		</table>
	</form>
	</td>
    <td width="40" background="images/middle4.jpg">&nbsp;</td>
  </tr>
  <tr>
    <td colspan="5"><img src="images/bottom.jpg" width="780" height="82"></td>
  </tr>
</table>
<s:debug></s:debug>
<P align="center">2014 搜房网 版权所有</P>
<br/>
</BODY>
</HTML>